<?php
use yii\bootstrap\Modal;

Modal::begin([
    'id' => 'action-modal',
    'size' => Modal::SIZE_DEFAULT,
    'header' => '<h4 class="modal-title">创建</h4>',
    'footer' => '<a href="#" class="btn btn-outline" id="redirect-url" >确定</a>',
]);
?>
<p></p>
    <!--<div class="m-b-md">
        <i class="fa fa-warning fa-4x"></i>
        <h1 class="m-xs">Alarm</h1>
        <h3 class="font-bold no-margins">
            Do
        </h3>
        <small>something</small>
    </div>-->
<?php Modal::end(); ?>
<?php

$jsStr = <<<EOF
    function showModelMessage(type, title, message, href){
        var modal = $('#action-modal');
        modal.removeClass('modal-success');
        modal.removeClass('modal-warning');
        modal.addClass('modal-'+type);
        modal.modal('show');
        modal.find('.modal-title').text(title);
        modal.find('.modal-body p').text(message);
        modal.find('#redirect-url').removeAttr('data-dismiss');
        if(type=="warning") {
            modal.find('#redirect-url').attr('data-dismiss', 'modal');
        }
        modal.find('#redirect-url').attr('href', href);
    }
EOF;
$this->registerJs($jsStr);
